class Solution
{
public:
    int countEven(int num)
    {
        auto digitSum = [](int n)
        {
            int result = 0;
            while (n)
            {
                result += n % 10;
                n /= 10;
            }
            return result;
        };
        int count = 0;
        for (int i = 1; i <= num; ++i)
        {
            if (!(digitSum(i) & 1))
            {
                ++count;
            }
        }
        return count;
    }
};